import DefaultToolbar from "./DefaultToolbar";
import ToolbarSlot from "./ToolbarSlot";
import { FC, ReactElement } from "react";

type RenderToolbarSlot = (toolbarSlot: ToolbarSlot) => ReactElement;

export interface ToolbarProps {
  children?: RenderToolbarSlot;
}

const Toolbar: FC<{
  children?: RenderToolbarSlot;
  slot: ToolbarSlot;
}> = ({ children, slot }) => {
  const render = children || DefaultToolbar;
  return render(slot);
};

export default Toolbar;
